/<template>
  <div>{{ name }}</div>
</template>

<script>
import { getCorpGroupName } from '@/api/miniApp'
export default {
  props: {
    groupId: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      name: ''
    }
  },
  watch: {
    groupId: function (newVal, oldVal) {
      console.log(newVal)
      if (newVal.length > 0) {
        this.onGetCorpGroupName()
      }
    }
  },
  mounted() {
    if (this.groupId.length > 0) {
      this.onGetCorpGroupName()
    }
  },
  methods: {
    async onGetCorpGroupName() {
      const res = await getCorpGroupName({ group_id: this.groupId })
      this.name = res.data
        .map((item, index) => {
          return item.group_name
        })
        .join('、')
    }
  }
}
</script>

<style>
</style>